home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Apple II Sample Code / APW.SC / SC19ActionNDA / NDAHeader.aii < prev    next >
Encoding:
Text File  |  1990-06-24  |  4.4 KB  |  105 lines  |  [TEXT/pdos]

  1. *******************************************************************************
  2. *
  3. * Developer Technical Support Apple II Sample Code
  4. *
  5. * This is a simple standard header for MPWIIGS Pascal NDAs.  It must be linked
  6. * first to the Pascal NDA code.
  7. *
  8. * Stack Note: This header cannot be used with NDAs that require large amounts
  9. *             of stack space.  The NDA will share the application's stack.
  10. *
  11. * SANE Note:  If your NDA is using any real data types (i.e., real, single,
  12. *             double, extended, comp, or computational types) or if you are
  13. *             using any built in procedures or functions that support real
  14. *             data types (i.e., Readln, Writeln, Trunc, Round, etc.), you
  15. *             cannot use this header with your NDA.
  16. *
  17. * Three lines in this header should be changed before you build your NDA.
  18. * The three lines are labeled NDAPeriod, NDAEventMask and NDAMenuLine.
  19. * See the Apple IIGS Toolbox Reference: Volume 1 for information on the
  20. * values of these three parameters.
  21. *
  22. * The Pascal NDA must have two procedures (NDAClose and NDAInit) and
  23. * two functions (NDAOpen and NDAAction).  These procedures and functions must
  24. * be identified to the linker as external with the $Z+ compiler directive.
  25. *
  26. * The required functions and procedures (NDAOpen, NDAClose, NDAAction and
  27. * NDAInit) are described the Desk Manager chapter of the Apple IIGS Toolbox
  28. * Reference: Volume 1.  Here is the description of how they must be declared
  29. * and used in your Pascal NDA:
  30. *
  31. *****
  32. * The NDAOpen Function
  33. *
  34. * Syntax:  FUNCTION NDAOpen: WindowPtr;
  35. *
  36. * The NDAOpen function is called when the NDA is selected from the Apple
  37. * menu.  NDAOpen returns a pointer to the NDA's window.
  38. *
  39. *****
  40. * The NDAClose Procedure
  41. *
  42. * Syntax:  PROCEDURE NDAClose;
  43. *
  44. * The NDAClose procedure has no inputs or outputs and must be able to work
  45. * even if the desk accessory is not open.
  46. *
  47. *****
  48. * The NDAAction Function
  49. *
  50. * Syntax:  FUNCTION NDAAction(code: Integer;
  51. *                             evntRecPtr: EventRecordPtr): integer;
  52. *
  53. * The NDAAction function is called whenever there is an action or event the
  54. * NDA needs to handle.  The action code is passed in the code variable.  If the
  55. * code is eventAction, the the variable evntRecPtr is a pointer to the event
  56. * record.  NDAAction returns a integer indicating whether the edit Action
  57. * commands (undoAction, cutAction, copyAction, pasteAction, clearAction) were
  58. * handled (non-zero = NDA handled edit Action).
  59. *
  60. *****
  61. * The NDAInit Procedure
  62. *
  63. * Syntax:  PROCEDURE NDAInit(code: Integer);
  64. *
  65. * The NDAInit procedure is called every time DeskStartUp or DeskShutDown is
  66. * called.  The code variable indicates which call was made.  A zero value
  67. * indicates a DeskShutDown call; a non-zero value indicates a DeskStartUp
  68. * call.
  69. *
  70. *******************************************************************************
  71.  
  72.                     CASE OBJ
  73.                     
  74. NDAHEADER           PROC EXPORT
  75.  
  76. ; Procedures and Functions in UPPER case
  77.                     IMPORT NDAOPEN,NDACLOSE,NDAACTION,NDAINIT
  78.  
  79.                     dc.l NDAOPEN        ; Pointer to the open routine
  80.                     dc.l NDACLOSE       ; Pointer to the close routine
  81.                     dc.l AsmAction      ; Pointer to the action routine glue
  82.                     dc.l AsmInit        ; Pointer to the init routine glue
  83. NDAPeriod           dc.w $0000          ; How often the NDA gets run actions
  84. NDAEventMask        dc.w $FFFF          ; Describes what events the NDA wants
  85.                     dc.b '**'           ; two place-holding characters
  86. NDAMenuLine         dc.b 'ActionNDA'    ; A default NDA menu item name
  87.                     dc.b '\H**'         ; \H and two place-holding characters
  88.                     dc.b 0              ; The menu item string terminator
  89.                     
  90. AsmAction           pha                 ; reserve space for integer result
  91.                     pha                 ; push the action code
  92.                     phy                 ; push high word of event record addr
  93.                     phx                 ; push low word of event record addr
  94.                     jsl NDAACTION       ; call the action routine
  95.                     pla                 ; get the integer result
  96.                     rtl                 ; and return
  97.                     
  98. AsmInit             pha                 ; push the init code
  99.                     jsl NDAINIT         ; call the init routine
  100.                     rtl                 ; and return
  101.  
  102.                     ENDP
  103.  
  104.                     END
  105.